package com.zmn.oms.third.jd_huadi;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * 类描述：京东华帝接口使用的常量类
 *
 * @author xiewenbing
 * @date 2020/05/21 11:12
 */
@Component
public class JdHuadiConsts {

    /**
     * 渠道名称
     */
    public static final String CHANNEL_NAME = "京东华帝";

    /**
     * 渠道厂商ID
     */
    public static final int JD_HUADI_FACTORY_ID = 29146;

    /**
     * 渠道厂商产品ID
     */
    public static final int JD_HUADI_FACTORY_PRODUCT_ID = 10306;

    /**
     * 渠道产品ID
     */
    public static final int JD_HUADI_PRODUCT_ID = 10667;

    /**
     * refresh URL
     */
    public static final String JD_HUADI_APP_REFRESH_URL = "https://open-oauth.jd.com/oauth2/refresh_token?app_key=%s&app_secret=%s&grant_type=refresh_token&refresh_token=%s";

    /**
     * token信息redis存储时限
     */
    public static final int JD_HUADI_TOKEN_REDIS_TIMEOUT = (3600 * 24 * 30);

    /**
     *  京东华帝渠道对接通信成功Code
     */
    public static final int JD_HUADI_RESPONSE_SUCCESS_CODE = 100;

    /**
     *  京东华帝渠道对接通信成功Code
     */
    public static final int JD_HUADI_RESPONSE_FAILED_CODE = 200;

    /**
     * 京东华帝渠道接入开关
     */
    public static boolean POWER_ON = false;

    /**
     * 拉取订单时每页数量
     */
    public static int PULL_ORDER_PAGE_SIZE = 100;

    /**
     * 拉取订单时最大页数
     */
    public static int PULL_ORDER_MAX_PAGE = 5;

    /**
     * APP KEY
     */
    public static String JD_HUADI_APP_KEY = "2328D276F27F2D2A3DF13F0CB4FB40FE";

    /**
     * APP SECRET
     */
    public static String JD_HUADI_APP_SECRET = "7c8b48af2a1a4e24907af63319861028";

    /**
     * 对接URL
     */
    public static String JD_HUADI_APP_URL = "https://api-dev.jd.com/routerjson";

    /**
     * access token
     */
    public static String JD_HUADI_APP_ACCESS_TOKEN = "2a315510e0b2484d929ca0958d954eeazmtu";

    /**
     * refresh token
     */
    public static String JD_HUADI_APP_REFRESH_TOKEN = "2ea960e752c644f385a1c861ce73e381wztc";

    /**
     * refresh timestamp
     */
    public static Long JD_HUADI_APP_REFRESH_TIMESTAMP = 1590571627978L;


    @Value("${JD_HudDi.service.powerOn:false}")
    public void setPowerOn(boolean powerOn){
        POWER_ON = powerOn;
    }

    @Value("${JD_HudDi.service.pullOrderPageSize:100}")
    public void setPageSize(int pageSize){
        PULL_ORDER_PAGE_SIZE = pageSize;
    }

    @Value("${JD_HudDi.service.pullOrderMaxPage:5}")
    public void setMaxPage(int maxPage){
        PULL_ORDER_MAX_PAGE = maxPage;
    }

    @Value("${JD_HudDi.service.appKey:2328D276F27F2D2A3DF13F0CB4FB40FE}")
    public void setAppKey(String appKey){
        JD_HUADI_APP_KEY = appKey;
    }

    @Value("${JD_HudDi.service.appSecret:7c8b48af2a1a4e24907af63319861028}")
    public void setAppSecret(String appSecret){
        JD_HUADI_APP_SECRET = appSecret;
    }

    @Value("${JD_HuaDi.service.appUrl:https://api-dev.jd.com/routerjson}")
    public void setAppUrl(String appUrl){
        JD_HUADI_APP_URL = appUrl;
    }

    @Value("${JD_HuaDi.service.accessToken:2a315510e0b2484d929ca0958d954eeazmtu}")
    public void setAccessToken(String accessToken){
        JD_HUADI_APP_ACCESS_TOKEN = accessToken;
    }

    @Value("${JD_HuaDi.service.refreshToken:2ea960e752c644f385a1c861ce73e381wztc}")
    public void setRefreshToken(String refreshToken){
        JD_HUADI_APP_REFRESH_TOKEN = refreshToken;
    }

    @Value("${JD_HuaDi.service.refreshTimestamp:1590571627978}")
    public void setRefreshTimestamp(Long refreshTimestamp){
        JD_HUADI_APP_REFRESH_TIMESTAMP= refreshTimestamp;
    }

    /**
     * 私有构造器，禁止外部实例化
     */
    private JdHuadiConsts() {}
}
